package com.forekenow.oop;

/**
 * 构造器的重载（OverLoad） :在调用构造器的时候会根据传入的参数决定调用哪一个构造器
 */
public class OverLoadDemo {
    public OverLoadDemo(){
        System.out.println("12323232");
    }

    public OverLoadDemo(int a){
        System.out.println(a);
    }
    public OverLoadDemo(String s,double d){
        System.out.println(s);
    }

    //方法重载
    public int add(int a,int b){
        return a+b;
    }
    public int add(int a,int b,int c){
        return a+b+c;
    }

    public static void main(String[] args) {

        OverLoadDemo overLoadDemo = new OverLoadDemo("abc",1);

    }
}
